<template>
	<view>
		<van-tabbar v-model="active" @change="goChange">
		  <van-tabbar-item icon="home-o">首页</van-tabbar-item>
		  <van-tabbar-item icon="apps-o">分类</van-tabbar-item>
		  <van-tabbar-item icon="shopping-cart">购物车</van-tabbar-item>
		  <van-tabbar-item icon="friends">个人中心</van-tabbar-item>
		</van-tabbar>
	</view>
</template>

<script> 
	import { ref } from 'vue';
	
	export default {
	    setup() {
	       const active = ref(0);
		   const goChange = (e)=>{
			   let router = ['index','cate','cart','user']
			   uni.reLaunch({
			   	url:`/pages/${router[e]}/index`
			   })
		   }
	       return { active,goChange };
	    },
	    props:{
		    index:{
				type:Number,
				default:0,
				required:true,
		    }
	    },
		created(){
			this.active = this.index
		}
	};
</script>

<style>
</style>